import useSWR from 'swr';
import { globalInfoApi } from '../api/global';
import { useAuthStore } from '@/app/cg06/store/useAuthStore';

export const useMapData = () => {
	const token = useAuthStore(s => s.token);
	const { data, error, isLoading } = useSWR(
		() => (token ? '/big-screen/screen/warehouseData/list' : null),
		globalInfoApi,
		{revalidateOnFocus: false}
    );
    
	return {
		data: data || [],
		isLoading,
		isError: error
	};
};

